package com.woniuxy.exception;

import com.woniuxy.utils.ResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 全局异常处理器
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler({NoPermissionException.class})
    public ResultVO globalException(Exception ex, HttpServletRequest request) {
        return ResultVO.failure("403", "没有操作权限");
    }
}
